module RongCloud
  module Apis
    
    module SensitiveWord
      def add_sensitive_word(word, replace_word = nil)
        args = { word: word }
        if replace_word.is_a?(String) && replace_word.length > 0
          args.merge!(replaceWord: replace_word)
        end

        request("/sensitiveword/add", args)
      end
      # front = back as alias
      alias_method :add_wordfilter, :add_sensitive_word

      def delete_sensitive_word(word)
        request("/sensitiveword/delete", {word: word})
      end
      alias_method :delete_wordfilter, :delete_sensitive_word

      def batch_delete_sensitive_word(words)
        request("/sensitiveword/batch/delete", words: [*words])
      end

      def sensitive_word_list
        request("/sensitveword/list")
      end
      alias_method :wordfilter_list, :sensitive_word_list
    end # end SensitiveWord
  end # end Apis
end # end RongCloud
